package com.example.chat.visitor.controller;

import com.example.chat.common.utils.ConvertUtils;
import com.example.chat.common.utils.ResultUtil;
import com.example.chat.visitor.pojo.dto.VisitorDTO;
import com.example.chat.visitor.pojo.vo.VisitorSaveVO;
import com.example.chat.visitor.service.VisitorService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/visitor")
public class VisitorController {
    @Resource
    VisitorService visitorService;

    @PostMapping("/save")
    public ResultUtil<Void> save(@RequestBody VisitorSaveVO vo) {
        visitorService.save(ConvertUtils.of(vo, VisitorDTO.class));
        return ResultUtil.ok();
    }

}
